#include "mymainwindow.h"
#include "ui_mymainwindow.h"

MyMainWindow::MyMainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MyMainWindow)
{
    ui->setupUi(this);
    //设置标题
    this->setWindowTitle("翻金币");
    //设置窗口的icon
    this->setWindowIcon(QIcon(":/res/Coin0001.png"));
    //设置窗口固定大小
    this->setFixedSize(320, 588);
    QRect deskRect = QApplication::desktop()->availableGeometry();
    this->move(deskRect.width() / 2 - this->width() / 2, deskRect.height() / 2 - this->height() / 2);


    mb = this->menuBar();
    QAction *exit = new QAction("exit", this);
    mb->addMenu("开始")->addAction(exit);

    connect(exit, &QAction::triggered, this, [&](){
        this->close();
    });

}

MyMainWindow::~MyMainWindow()
{
    delete mb;
    mb = NULL;
    delete ui;
    ui = NULL;
}

void MyMainWindow::paintEvent(QPaintEvent *event)
{
    QPainter q(this);
    QPixmap pm(":/res/MenuSceneBg.png");
    q.drawPixmap(0,0, this->width(), this->height(), pm);
}

